package com.ty.springbootredis.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * Role
 *
 * @aurhor Administrator  whs
 * @since 2024/8/30
 */
@TableName("sys_role")
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Role implements Serializable {

    @TableField("role_id")
    private Long roleId;  // 编号
    private String roleName; // 角色名称
    private String roleDesc; // 角色描述
    private Integer roleFlag; // 状态

    @JsonIgnore   // 忽略属性
    private Set<User> users = new HashSet<>();

    // 双向一对多关联
//    @OneToMany(targetEntity = User.class , fetch = FetchType.LAZY , cascade = CascadeType.REMOVE , mappedBy = "role")
//    private Set<User> users = new HashSet<User>();



}
